package cn.chengpengper.im.platform.common.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/*@formatter:off*/

/**
 * ____________________
 * < 神兽护体，永无bug! >
 * --------------------
 *
 * @author huchengpeng
 * @version v1.0.0
 * @date 2024/11/23 15:15
 * @description 私聊消息实体对象
 */

/*@formatter:on*/

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("im_private_message")
public class PrivateMessage extends Model<PrivateMessage> implements Serializable {

    private static final long serialVersionUID = 7638734055630087646L;

    @TableId(value = "id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @TableField("send_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long sendId;

    @TableField("receiver_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long receiverId;

    @TableField("content")
    private String content;

    /**
     * 消息类型 0:文字 1:图片 2:文件 3:语音  10:撤回消息
     */
    @TableField("type")
    private Integer type;

    @TableField("status")
    private Integer status;

    @TableField("send_time")
    private Date sendTime;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
